package com.example.memo;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.example.memo.entity.NoteInfo;

public class NotePage extends AppCompatActivity {
    private TextView title,content;
    private Toolbar toolbar;
    private NoteInfo noteInfo;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_note_page);

        initView();
        initData();
    }

    private void initView() {
        title = findViewById(R.id.title);
        content = findViewById(R.id.content);
        toolbar = findViewById(R.id.toolbar);

        toolbar.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }

    private void initData() {
        noteInfo = (NoteInfo) getIntent().getSerializableExtra("noteInfo");
        if(noteInfo != null){
            title.setText(noteInfo.getTitle());
            content.setText(noteInfo.getContent());
        }
    }
}